package repository

import (
	"yak.admin/src/entity"
	"yak.admin/src/repository"
	"yak.admin/src/util"
)

type UserRepository struct {
	repository.RegionRepository
}

func (repository *UserRepository) FindOneByToken(token string) (entity.User, bool) {
	user := entity.User{}
	rowsAffected := util.GetMysqlPool().Handler().
		Where("token = ?", token).First(&user).RowsAffected
	return user, rowsAffected > 0
}
